
$(function () {
  var $texts = $("#username");
  var $password = $("#password");

  $("#login").click(function () {
    var username = $texts.val();
    var password = $password.val();

    $.ajax({
      type: "POST",
      url: "/login",
      async:false,
      data: {"username":username, "password":password},
      dataType: "json",
      success: function(data){
        if (data == ""||data == null){
          alert("服务器繁忙");
        }
        if (data.code == 200){
          alert(data.msg);
          setTimeout(function () {
            location.href = data.data;
          },1000);
        }else {
          alert(data.msg);
        }
      }
    })
  })



})
